package systemModel

import (
	"CommonsProject/models/commonsModel"
	_ "gorm.io/driver/mysql"
)

type SysUser struct {
	commonsModel.Model
	Username *string `form:"username" json:"username" gorm:"column:username;unique;index;size:100;comment:用户名"`
	Password *string `form:"password" json:"password" gorm:"column:password;size:512;comment:密码"`
	Age      *int    `from:"age" json:"age" gorm:"column:age;comment:年龄"`
	Email    *string `form:"email" json:"email" gorm:"column:email;comment:邮箱"`
	Nickname *string `form:"nickname" json:"nickname" gorm:"column:nickname;comment:昵称"`
	Address  *string `form:"address" json:"address" gorm:"column:address;comment:地址"`

	//多对多关系
	SysRoles   []*SysRole   `json:"sysRoles" gorm:"many2many:sys_user_role"`
	SysRouters []*SysRouter `json:"sysRouters" gorm:"many2many:sys_user_router"`
}

func (u SysUser) TableName() string {
	return "sys_user"
}
